MAKECOMMAND = make
CLEAN = make clean

FLEALIBDIR = Lib
FLEAUIDIR = Ui
FLEALIBTARGET = libflealib.so.0.9.1
FLEAUITARGET = Ui
FLEACONSOLETARGET = netflea-nonui
FLEAUIRESOURCE = Ui/icons
FLEACONFIGDIR=.netflea
FLEALOCALERESOURCE = Ui/locale
FLEALIBPATH = /usr/lib
FLEAUIPATH = /usr/bin
FLEACONSOLEDIR = Console
FLEARESOURCEPATH = /usr/share/netflea
FLEALAUNCHER=Launcher/Netflea.desktop
FLEARELEASEDIR=release
GCC=g++
all: Makefile flealib fleaui nonui

flealib:
	${MAKECOMMAND} -C ${FLEALIBDIR}

fleaui:
	${MAKECOMMAND} -C ${FLEAUIDIR}
nonui:
	${MAKECOMMAND} -C ${FLEACONSOLEDIR}

install:
	-rm -rf  ${FLEARESOURCEPATH}
	-mkdir ${FLEARESOURCEPATH}
	-mkdir ${HOME}/${FLEACONFIGDIR}
	-chmod -R 777  ${HOME}/${FLEACONFIGDIR}
	cp ${FLEALIBDIR}/${FLEALIBTARGET} ${FLEALIBPATH}/${FLEALIBTARGET}
	cp ${FLEAUIDIR}/${FLEAUITARGET} ${FLEAUIPATH}/fleaui
	cp ${FLEACONSOLEDIR}/${FLEACONSOLETARGET} ${FLEAUIPATH}/${FLEACONSOLETARGET}
	cp -rf ${FLEAUIRESOURCE} ${FLEARESOURCEPATH}/
	cp -rf ${FLEALOCALERESOURCE} ${FLEARESOURCEPATH}/
	cp  ${FLEALAUNCHER} ${HOME}/Desktop/

uninstall:
	-rm -rf ${FLEARESOURCEPATH}
	-rm -f ${FLEAUIPATH}/fleaui
	-rm -f ${FLEAUIPATH}/${FLEACONSOLETARGET}
	-rm -f ${FLEALIBPATH}/${FLEALIBTARGET}
	-rm -f ${HOME}/Desktop/Netflea.desktop


clean:
	cd ${FLEALIBDIR} && ${CLEAN}
	cd ${FLEAUIDIR} && ${CLEAN}
	cd ${FLEACONSOLEDIR} && ${CLEAN}


